<HTML><HEAD><TITLE>make_suspension(+Goal, +Prio, -Susp, +Module)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">Advanced Control and Suspensions</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>make_suspension(+Goal, +Prio, -Susp, +Module)</H1>
Make Goal from module Module a suspended goal with waking priority Prio and
return the corresponding suspension object in Susp.


<DL>
<DT><EM>Goal</EM></DT>
<DD>A Prolog Goal.
</DD>
<DT><EM>Prio</EM></DT>
<DD>A small integer.
</DD>
<DT><EM>Susp</EM></DT>
<DD>A variable.
</DD>
<DT><EM>Module</EM></DT>
<DD>An atom.
</DD>
</DL>
<H2>Description</H2>
   The goal Goal from module Module is made a suspended goal, i.e. it
   enters the suspended part of the resolvent and shows up as a delayed
   goal.  When the debugger is on, a DELAY port is generated.
<P>
   A suspension can be in three states:
<PRE>
	State		Printed as
	---------------------------------
	sleeping	'SUSP-_123-susp'
	scheduled	'SUSP-_123-sched'
	dead		'SUSP-_123-dead'
</PRE>
<P>
   The Prio argument determines the priority with which the Goal will be
   scheduled when woken. It can be a positive number between 1 and 12,
   or zero, in which case the priority defaults to the priority setting
   of the predicate which is called in Goal.
<P>
   Note that a suspension is not a standard Prolog data structure and can
   only be manipulated in a restricted way.  In particular, a suspension is
   not an atom although it gets printed by default in the form
   'SUSP-_123-susp'.   The only way to create a suspension is with
   make_suspension/3,4, suspend/3,4 or by copying an existing suspension.
   The contents of a suspension can only be retrieved using get_suspension_data/3.
<P>

<H3>Modes and Determinism</H3><UL>
<LI>make_suspension(+, +, -, +) is det
</UL>
<H3>Exceptions</H3>
<DL>
<DT><EM>(4) instantiation fault </EM>
<DD>Goal is not instantiated.
<DT><EM>(4) instantiation fault </EM>
<DD>Module is not instantiated.
<DT><EM>(5) type error </EM>
<DD>Goal is not a callable term.
<DT><EM>(5) type error </EM>
<DD>Susp is not a variable.
<DT><EM>(5) type error </EM>
<DD>Prio is not an integer.
<DT><EM>(5) type error </EM>
<DD>Module is not an atom.
<DT><EM>(6) out of range </EM>
<DD>Prio is not a valid priority.
<DT><EM>(60) referring to an undefined procedure </EM>
<DD>Goal refers to an undefined precedure.
</DL>
<H2>See Also</H2>
<A HREF="../../kernel/suspensions/suspend-3.html">suspend / 3</A>, <A HREF="../../kernel/suspensions/insert_suspension-4.html">insert_suspension / 4</A>, <A HREF="../../kernel/typetest/is_suspension-1.html">is_suspension / 1</A>, <A HREF="../../kernel/suspensions/make_suspension-3.html">make_suspension / 3</A>, <A HREF="../../kernel/suspensions/schedule_suspensions-1.html">schedule_suspensions / 1</A>, <A HREF="../../kernel/suspensions/schedule_suspensions-2.html">schedule_suspensions / 2</A>, <A HREF="../../kernel/suspensions/get_suspension_data-3.html">get_suspension_data / 3</A>, <A HREF="../../kernel/suspensions/wake-0.html">wake / 0</A>
</BODY></HTML>
